<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    table {
      border: 1px solid #333;
      border-collapse: collapse;
    }
    td {
      border: 1px solid #333;
    }
  </style>
</head>
<body>
  <script>
    // 在这里可以定义形参来接收传递过来的实参
    function createTable (row, col) {
      var str = '<table>'
      for (var i = 0; i < row; i++) {
        str += '<tr>'
        for (var j = 0; j < col; j++) {
          str += '<td>11</td>'
        }
        str += '</tr>'
      }
      str += '</table>'
      document.write(str)
    }
    // 多次调用函数实现代码复用
    // 函数调用得时候传递实参
    createTable(3, 10)
    
    createTable(5, 2)

  </script>
</body>
</html>